#include <iostream>

int main(int argc, char const *argv[])
{
    int a = 100;
    int b = 200;
    int &c = a; // c的地址和a的相同，

    using namespace std;

    cout << "a = " << a << endl; // 100
    cout << "b = " << b << endl; // 200 
    cout << "c = " << c << endl; // 100
    cout << "&a = " << &a << endl;
    cout << "&b = " << &b << endl;
    cout << "&c = " << &c << endl;

    c = b; // 引用没有更改，只是赋值操作而已 引用相当于别名，相当于a，即设置了 a = b(b为200)，此时a = 200 作为 a 的别名 c 也就是200，所以a = b = c = 200 
    cout << "a = " << a << endl; // 200
    cout << "b = " << b << endl; // 200 
    cout << "c = " << c << endl; // 200
    cout << "&a = " << &a << endl; // 地址和上面一样的
    cout << "&b = " << &b << endl;
    cout << "&c = " << &c << endl;

    // &c = b; // 错误，引用不可以更改

    return 0;
}
